package db

import (
	"github.com/go-redis/redis"
	"log"
	"poem-server/comm/global"
	"poem-server/initialize/config"
)

func RedisInit() {
	// redis 配置
	var (
		addr     = config.Config.Redis.Addr
		password = config.Config.Redis.Password
		db       = config.Config.Redis.Db
	)

	// 连接redis
	global.App.Redis = redis.NewClient(&redis.Options{
		Addr:     addr,     //ip + 端口
		Password: password, // redis 密码
		DB:       db,       //数据库
	})
	log.Println("===========>redis数据库init~", global.App.Redis)
}
